/**
 * 测站类型管理 DTO
 * 
 * 包含测站类型相关的数据传输对象
 * 
 */

import { ApiProperty } from '@midwayjs/swagger';

// ========== 公共 DTO ==========

/**
 * 分页查询基础 DTO
 */
export class BasePageQuery {
    @ApiProperty({ description: '页码', example: 1, required: false })
    pageNum?: number = 1;

    @ApiProperty({ description: '每页数量', example: 10, required: false })
    pageSize?: number = 10;
}

/**
 * 分页结果 DTO
 */
export class PageResultDTO<T> {
    @ApiProperty({ description: '数据列表' })
    list: T[];

    @ApiProperty({ description: '总数量', example: 100 })
    total: number;

    @ApiProperty({ description: '当前页码', example: 1 })
    pageNum: number;

    @ApiProperty({ description: '每页数量', example: 10 })
    pageSize: number;

    @ApiProperty({ description: '总页数', example: 10 })
    totalPages: number;
}

// ========== 测站类型相关 DTO ==========

/**
 * 创建测站类型 DTO
 */
export class CreateStationTypeDTO {
    @ApiProperty({ description: '测站类型编码', example: 'ST001' })
    stationTypeCode: string;

    @ApiProperty({ description: '测站类型名称', example: '土含测站' })
    stationTypeName: string;

    @ApiProperty({ description: '测站类型描述', example: '用于监测土壤含水量的测站', required: false })
    description?: string;

    @ApiProperty({ description: '数据采集频率', example: '小时', required: false })
    collectFrequency?: string;

    @ApiProperty({ description: '状态(1-启用 0-禁用)', example: 1, required: false })
    status?: number;

    @ApiProperty({ description: '排序序号', example: 1, required: false })
    sortOrder?: number;

    @ApiProperty({ description: '备注信息', example: '重要测站类型', required: false })
    remark?: string;
}

/**
 * 批量导入测站类型 DTO
 */
export class BatchImportStationTypeDTO {
    @ApiProperty({ description: '测站类型列表', type: [CreateStationTypeDTO] })
    stationTypeList: CreateStationTypeDTO[];
}

/**
 * 更新测站类型 DTO
 */
export class UpdateStationTypeDTO {
    @ApiProperty({ description: '测站类型编码', example: 'ST001', required: false })
    stationTypeCode?: string;

    @ApiProperty({ description: '测站类型名称', example: '土含测站', required: false })
    stationTypeName?: string;

    @ApiProperty({ description: '测站类型描述', example: '用于监测土壤含水量的测站', required: false })
    description?: string;

    @ApiProperty({ description: '数据采集频率', example: '小时', required: false })
    collectFrequency?: string;

    @ApiProperty({ description: '状态(1-启用 0-禁用)', example: 1, required: false })
    status?: number;

    @ApiProperty({ description: '排序序号', example: 1, required: false })
    sortOrder?: number;

    @ApiProperty({ description: '备注信息', example: '重要测站类型', required: false })
    remark?: string;
}

/**
 * 查询测站类型 DTO
 */
export class QueryStationTypeDTO extends BasePageQuery {
    @ApiProperty({ description: '测站类型编码', required: false })
    stationTypeCode?: string;

    @ApiProperty({ description: '测站类型名称', required: false })
    stationTypeName?: string;

    @ApiProperty({ description: '状态(1-启用 0-禁用)', required: false })
    status?: number;

    @ApiProperty({ description: '数据采集频率', required: false })
    collectFrequency?: string;
}

/**
 * 测站类型返回 DTO
 */
export class StationTypeResponseDTO {
    @ApiProperty({ description: 'ID', example: 'uuid' })
    id: string;

    @ApiProperty({ description: '测站类型编码', example: 'ST001' })
    stationTypeCode: string;

    @ApiProperty({ description: '测站类型名称', example: '土含测站' })
    stationTypeName: string;

    @ApiProperty({ description: '测站类型描述', example: '用于监测土壤含水量的测站' })
    description?: string;

    @ApiProperty({ description: '数据采集频率', example: '小时' })
    collectFrequency?: string;

    @ApiProperty({ description: '状态(1-启用 0-禁用)', example: 1 })
    status: number;

    @ApiProperty({ description: '排序序号', example: 1 })
    sortOrder?: number;

    @ApiProperty({ description: '备注信息', example: '重要测站类型' })
    remark?: string;

    @ApiProperty({ description: '创建时间' })
    createdAt: Date;

    @ApiProperty({ description: '更新时间' })
    updatedAt: Date;
}

/**
 * 批量删除 DTO
 */
export class BatchDeleteDTO {
    @ApiProperty({ description: 'ID列表', example: ['uuid1', 'uuid2'] })
    ids: string[];
}

/**
 * 通用响应 DTO
 */
export class CommonResponseDTO<T = any> {
    @ApiProperty({ description: '状态码', example: 200 })
    code: number;

    @ApiProperty({ description: '消息', example: '操作成功' })
    message: string;

    @ApiProperty({ description: '数据' })
    data?: T;

    @ApiProperty({ description: '时间戳', example: 1640995200000 })
    timestamp: number;
}